#include <bits/stdc++.h>
using namespace std;

int dif[500005] ;
int main() {
  int n,m;
  cin >> n>>m;
  string s, t;
  cin >> s >> t;
  s = " " + s;
  t = " " + t;
  for (int i = 1; i <= m; i++) {
    int L, R;
    cin >> L >> R;
    dif[L]++;
    dif[R + 1]--;
  }
  for (int i = 1; i <= n; i++) {
    dif[i] += dif[i - 1];//求前缀和，得到原数组
    dif[i] %= 2;
  }
  for (int i = 1; i <= n; i++) {
    cout << (dif[i] == 0 ? s[i] : t[i]);
  }

  return 0;
}
